<template>
  <div class="home">
    <!-- 输入框 -->
     <div id="search">

      <input type="text" placeholder="输入商家、商品名称" @click="tosearch()">
    <div class="swiper">
    <!-- <div>
        <search></search>
    </div> -->
    <!-- 轮播图 -->
<van-swipe :autoplay="3000" >
  <van-swipe-item v-for="(image, index) in lunlist" :key="index">
    <img v-lazy="image.bannerUrl" />
  </van-swipe-item>
</van-swipe>


    </div>

   </div>
  

    <!-- 店铺列表 -->
    <div class="shoplist">
      <div @click="toDetail(item)" class="shop" v-for="(item,index) in shoplist" :key="index">
        <div class="imgbox">
          <img :src="item.picUrl" alt="">
        </div>
        <div class="text">
          <div class="name">{{item.name}}</div>
          <div class="sale"> ☆ {{item.wmPoiScore/10}} {{item.monthSalesTip}}</div>
          <div class="desc">{{item.minPriceTip}} {{item.shippingFeeTip}}</div>
        </div>
      </div>
    </div>
  </div>
</template>

<script>
import { mapActions, mapState } from 'vuex'
import { shop_list,banner_list } from '../../utils/api'
// import search from "../../components/Search.vue";
export default {
  data(){
    return {
      shoplist:[],
      lunlist:[],
      // searchlist:[]
    }


  },
  mounted(){
    // 请求爆爆团店铺列表
    shop_list().then((res)=>{
      console.log(res.data);
      this.shoplist = res.data.list
    }),
        // 轮播图
   
      banner_list().then((res)=>{
        console.log(res.data.list);
        this.lunlist=res.data.list;
      
      }),
        banner_list().then((res)=>{
        console.log(res.data.list);
        this.lunlist=res.data.list;
      
      })

 

 
  },
  methods:{
    toDetail(item){ //跳转到详情页
      this.$router.push('/detail/'+item.mtWmPoiId);
    },
    tosearch(){
       this.$router.push('/search');
    },
    ...mapActions('request_list')
  },
  // components:{
  //   search
  // }
}
</script>

<style lang='scss' scoped>
.shoplist{
  margin: 10px;
  .shop{
    display: flex;
    margin: 10px 0;
    .imgbox{
      width: 80px;
      margin-right: 10px;
      img{
        width: 100%;
      }
    }
    .text{
      font-size: 12px;
    }
  }
}

 #search{
    padding: 10px;
    background: lightblue;
  }
  #search input{
    height: 40px;
    text-align: center;
    border-radius: 10px;
    background-color: white;
    color: #555;
    width: 100%;
    border: none;
    outline: none;
  }
  .swiper{
    margin: 10px;
    height: 100%;
   }
   img{
    width: 100%;
    border-radius: 10px;
   }

     .my-swipe .van-swipe-item {
    color: #fff;
    font-size: 20px;
    // line-height: 80px;
    text-align: center;
    // background-color: #39a9ed;
  }
   .my-swipe img{
    width: 100%;
    height: 120px;
    text-align: center;
    // margin-top: 40px;
    // line-height: 12px;
   }
</style>